/*
 * Copyright (c) 2018 Hitevision
 */

package tw.com.hitevision.whiteboard.android.render;

import android.content.Context;

import tw.com.hitevision.whiteboard.android.stateFile.PenStateFile;

public class Pen extends Line {
    private Context context;

    public Pen(Context context, float x, float y, float thickness) {
        super(context, x, y, thickness);
        this.context = context;
    }

    public PenStateFile getPenStateFile() {
//        return new PenStateFile(this, points, thickness, getId(), getFollowingStickynoteId());
        return new PenStateFile(this, points, thickness, getId());
    }

    @Override
    public BaseItem copy() {
        Pen temp = new Pen(context, startX, startY, thickness);
        temp.clear();
        temp.path.set(getPath());

        for (int i = 0; i < points.size(); i++) {
            DiffPoint tempDP = new DiffPoint(points.get(i).x, points.get(i).y);
            tempDP.dx = points.get(i).dx;
            tempDP.dy = points.get(i).dy;
            temp.points.add(tempDP);
        }
        temp.x = x;
        temp.y = y;
        temp.width = width;
        temp.height = height;
        temp.detectRegion.set(detectRegion);
        temp.setColor(getColor());
//        temp.updateDetectRegion();
        temp.updatePathAgain = true;
        return temp;
    }
}
